		TITLE	CVSTAALL - Copyright (c) SLR Systems 1994

		INCLUDE	MACROS

if	fg_cvpack

		INCLUDE	CVTYPES

		PUBLIC	CV_STATICS_ALL_4


		.DATA

		EXTERNDEF	CV_TEMP_RECORD:BYTE

		EXTERNDEF	CURNMOD_NUMBER:DWORD,CV_PUB_TXT_OFFSET:DWORD,CV_PUB_SYMBOL_ID:DWORD,CVG_SEGMENT:DWORD
		EXTERNDEF	CV_REFSYM_CNT:DWORD,BYTES_SO_FAR:DWORD,CVG_SYMBOL_OFFSET:DWORD,CVG_SEGMENT_OFFSET:DWORD
		EXTERNDEF	CVG_SYMBOL_HASH:DWORD,FIRST_SSYM_GINDEX:DWORD

		EXTERNDEF	CV_SSYM_GARRAY:STD_PTR_S,CV_SSYM_STUFF:ALLOCS_STRUCT


		.CODE	CVPACK_TEXT

		EXTERNDEF	MOVE_TEXT_TO_OMF:PROC,HANDLE_CV_INDEX:PROC,FLUSH_CV_TEMP:PROC,_store_cv_symbol_info:proc
		EXTERNDEF	_output_cv_symbol_align:proc,_init_cv_symbol_hashes:proc,_flush_cv_symbol_hashes:proc
		EXTERNDEF	_release_minidata:proc,RELEASE_GARRAY:PROC,SAY_VERBOSE:PROC,GET_NAME_HASH32:PROC


CV_STATICS_ALL_4	PROC
		;
		;OUTPUT GLOBALPUBLIC TABLE
		;
		;
		;INITIALIZE STUFF
		;
		PUSHM	EDI,ESI,EBX

		MOV	EAX,OFF DOING_SSTSTATICSYM_MSG
		CALL	SAY_VERBOSE

		RESS	DOING_4K_ALIGN			;WE DON'T WANT S_ALIGN SYMBOLS

		CMP	CV_REFSYM_CNT,1
		JAE	L0$

		MOV	EAX,OFF CV_SSYM_GARRAY
		CALL	RELEASE_GARRAY

		MOV	EAX,OFF CV_SSYM_STUFF
		push	EAX
		call	_release_minidata
		add	ESP,4

		POPM	EBX,ESI,EDI

		RET

L0$:
		call	_init_cv_symbol_hashes
		;
		;MODULE BY MODULE, ADD PUBLIC SYMBOLS TO TABLE
		;
		MOV	ESI,FIRST_SSYM_GINDEX
		JMP	L8$

L1$:
		CONVERT	ESI,ESI,CV_SSYM_GARRAY
		ASSUME	ESI:PTR CV_GLOBALSYM_STRUCT

		MOV	EAX,[ESI]._NEXT_GSYM_GINDEX
		MOV	EDI,OFF CV_TEMP_RECORD

		PUSH	EAX
		CALL	CREATE_STASYM		;RETURNS DX == SEGMENT, CX:BX IS OFFSET

		MOV	EAX,OFF CV_TEMP_RECORD
		push	EAX
		call	_output_cv_symbol_align	;DO DWORD ALIGN, 4K ALIGN, RETURN OFFSET
		add	ESP,4

		MOV	CVG_SYMBOL_OFFSET,EAX	;STORE SYMBOL OFFSET
		call	_store_cv_symbol_info	;STORE INFO FOR SYMBOL HASHES

		POP	ESI
L8$:
		TEST	ESI,ESI
		JNZ	L1$

		MOV	EAX,OFF CV_SSYM_GARRAY
		CALL	RELEASE_GARRAY

		MOV	EAX,OFF CV_SSYM_STUFF
		push	EAX
		call	_release_minidata
		add	ESP,4
		;
		;  1.  DO NAME HASH TABLE
		;  2.  DO ADDRESS HASH TABLE
		;  3.  WRITE HEADER
		;  4.  DO CV_INDEX
		;
		MOV	CURNMOD_NUMBER,-1

		push	EDI
		MOV	EAX,0134H
		push	EAX
		call	_flush_cv_symbol_hashes
		add	ESP,8

		POPM	EBX,ESI,EDI

		RET

CV_STATICS_ALL_4	ENDP


CREATE_STASYM	PROC	NEAR
		;
		;SET HASH VARIABLES, SEG-OFFSET VARIABLES
		;
		ASSUME	ESI:PTR CVG_REF_STRUCT,EDI:PTR CV_REF_STRUCT

		MOV	EAX,[ESI]._HASH
		MOV	EBX,DPTR [ESI]._LENGTH		;SYMBOL TYPE

		MOV	BL,SIZE CV_REF_STRUCT-2
		MOV	CVG_SYMBOL_HASH,EAX

		MOV	BH,0
		MOV	[EDI]._CHECKSUM,EAX
		;
		;ONLY SYMBOL TYPES ARE:
		;
		;	I_S_DATAREF
		;	I_S_PROCREF
		;
		MOV	EAX,[ESI]._ALIGN_OFF
		MOV	DPTR [EDI]._LENGTH,EBX		;LENGTH & ID

		MOV	[EDI]._OFFSET,EAX

		MOV	EAX,DPTR [ESI]._MODULE		;& SEGMENT
		MOV	EDX,[ESI]._OFFSET

		MOV	ECX,EAX
		AND	EAX,0FFFFH

		SHR	ECX,16
		MOV	DPTR [EDI]._MODULE,EAX		;& FILLER

		MOV	CVG_SEGMENT,ECX
		MOV	CVG_SEGMENT_OFFSET,EDX

		RET

CREATE_STASYM	ENDP


		.CONST

DOING_SSTSTATICSYM_MSG DB	SIZEOF DOING_SSTSTATICSYM_MSG-1,'Doing SSTSTATICSYM',0DH,0AH

endif

		END

